package com.qmt.qmttest;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;


public class Popup extends Activity implements OnClickListener {

	NotificationManager nm;
	static final int uniqueID = 13923423;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.popup);
		Button stat = (Button)findViewById(R.id.bStatusBar);
		stat.setOnClickListener(this);
		nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
		nm.cancel(uniqueID);
		/*
		AlertDialog alertDialog = new AlertDialog.Builder(this).create();
		alertDialog.setTitle("Title");
		alertDialog.setMessage("Message");
		alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
		   public void onClick(DialogInterface dialog, int which) {
		      // TODO Add your code for the button here.
		   }
		});
		// Set the Icon for the Dialog
		alertDialog.setIcon(R.drawable.quranicon);
		alertDialog.show();
		*/
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		Intent intent = new Intent(this, Popup.class);		
		PendingIntent pi = PendingIntent.getActivity(this, 0, intent, 0);		
		String body = "Saatnya menghapal Quran :)";
		String title = "MQT";
		Notification n = new Notification(R.drawable.quranicon, body, System.currentTimeMillis());
		n.setLatestEventInfo(this, title, body, pi);
		n.defaults = Notification.DEFAULT_LIGHTS;
		nm.notify(uniqueID, n);
		
		
		
		finish();
	}	
}
